<template>
	<view class="myNote">
		<template v-for="(item,index) in noteData">
			<view class="noteOne">
				<uni-question class="quesBoxItem" :quesItem="item" :key="index"></uni-question>
			</view>
		</template>
		<uni-nodata v-if="noteData.length==0" :iconStyle="{margin:'100rpx 0 0'}"></uni-nodata>
	</view>
</template>

<script>
	import { myNote } from "@/api/mine.js"
	export default {
		data() {
			return {
				page:1,
				pageSize:20,
				pageTotal:0,
				noteData:[]
			};
		},
		onShow() {
			this.initPage()
			this.getList()
		},
		methods:{
			initPage(){
				this.page=1;
				this.noteData=[];
			},
			getList(){
				let param={
					page:this.page,
					size:this.pageSize,
					userId:uni.getStorageSync('userId'),
				}
				myNote(param).then((res)=>{
					if(res.code==100000){
						this.noteData=this.noteData.concat(res.data.rows)
						this.pageTotal=Math.ceil(res.data.total/this.pageSize)
					}
				})
			},
		},
		onPullDownRefresh() {
			this.initPage()
			this.getList()
			setTimeout(()=>{
				uni.stopPullDownRefresh()
			},1000)
		},
		onReachBottom() {
			if(this.page<this.pageTotal){
				++this.page
				this.getList()
			}else{
				uni.showToast({
					title:'我也是有底线的',
					icon:'none'
				})
			}
		}
	}
</script>
<style lang="scss">
page{
	background: $pageBgColor;
}
</style>
<style lang="scss" scoped>
.noteOne{
	margin:0 0 20rpx;
}
</style>
